//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//

//
#ifndef Green_BootOrderGPGPU_H
#define Green_BootOrderGPGPU_H

#include "BootOrder.h"

namespace Green {

  class Register;

  /*!
    \class BootOrderGPGPU
    \brief Class processing BootElement ordering in GPGPU
  */
  class BootOrderGPGPU : public BootOrder {
  public:
    Object * Clone() const override;                         //!<  Clone function for BootOrderGPGPU object.
    const char* Type() const override { return "BootOrderGPGPU"; }    //!< Type function for BootOrderGPGPU class
    //BootOrderGPGPU(): BootOrder(), mUseEret(false) {} //!< default constructor
    BootOrderGPGPU() : BootOrder() {} //!< default constructor
    ~BootOrderGPGPU();                    //!< destructor
    ASSIGNMENT_OPERATOR_ABSENT(BootOrderGPGPU);
    void InitiateRegisterList(std::list<Register*>& regList) override; //!< Initialize for mRegisterList;
    void AdjustOrder() override;         //!< override the base function to adjust the order for GPGPU architecture.
    void LastRegistersLoadingRequest(std::vector<GenRequest*>& rRequests, bool load_all) override; //!< load the last set of registers
    uint32 GetLastRegistersRequestOffset() override; //!< return total instr offset of the last set of registers
    //bool UseEret() const { return mUseEret; } //!< Return whether to use ERET at the end of boot code.
  protected:
    BootOrderGPGPU(const BootOrderGPGPU& rOther); //!< Copy constructor.
    //void AppendInstructionBarrier(std::vector<GenRequest*>& rRequests) override; //!< Append instruction barrier.
  private:
    void InsertSystemRegister(const std::list<BootElement*>::iterator& rBootElemItr, size_t& numSysRegs); //!< Move the specified system register boot element into the appropriate place in the boot element list.
  };

}

#endif
